import request from "@/utils/request";
import type {
  RequestJobParmType,
  RequestIdType,
  RequestCommunityParmType,
  RequestSubmitCommentType,
  RequestPublishCommonityType,
  RequsestAddTeacherType,
  RequestMyJlType,
  RequestFeedBackType,
  RequestAddCareType,
  RequestCareListType,
  RequestUpadateUserInfo,
  RequestMyCommentType,
  RequestCollectJobType,
  RequestCencelCollectJobType,
  RequestCencelCareType,
  RequestParmType,
} from "@/types/requstParm";

// 获取职位信息列表
export const getJobList = (data: RequestJobParmType) =>
  request("/index/lists", "GET", data);

// 获取企业单位列表
export const getCompanyJobList = (data: RequestJobParmType) =>
  request("/index/companyLists", "GET", data);

// 获取职位详情
export const getJobDetail = (data: RequestIdType) =>
  request("/job_info/info", "GET", data);

// 获取地区列表
export const getCityList = () => request("/index/getCityList", "GET");

// 获取职业分类
export const getJobCate = () => request("/index/catList", "GET");

// 获取社区列表
export const getCommunityList = (data: RequestCommunityParmType) =>
  request("/trends/lists", "GET", data);

// 获取社区详情
export const getCommunityDetail = (data: RequestIdType) =>
  request("/trends/info", "GET", data);

// 上传多图片
export const uploadMore = (data: string) =>
  request("/upload/uploadMore", "POST", data);

// 上传单图片
export const uploadDMore = (data: string) =>
  request("/upload/temporary", "POST", data);

// 回复社区动态
export const replyComment = (data: RequestSubmitCommentType) =>
  request("/trends/reply", "POST", data);

// 发布社区动态
export const publishCommunity = (data: RequestPublishCommonityType) =>
  request("/trends/publish", "POST", data);

// 获取名师列表
export const getTearchList = (data: RequestCommunityParmType) =>
  request("/teacher/lists", "GET", data);

// 获取名师添加配置
export const getTeacherConfig = () =>
  request("/index/getConfigTeachear", "GET");

// 添加名师
export const addTeacher = (data: RequsestAddTeacherType) =>
  request("/teacher/apply", "POST", data);

// 请求地址
export const getAddressTree = () => request("/user/getCityTree", "GET");

// 添加简历
export const addNode = (data: RequestMyJlType) =>
  request("/user/addNote", "POST", data);

// 获取简历详情
export const getJlDetail = (data: RequestIdType) =>
  request("/user/getNote", "GET", data);

export const getNoteConfig = () => request("/user/getNoteConfig", "GET");

// 意见反馈
export const feedback = (data: RequestFeedBackType) =>
  request("/user/feedback", "POST", data);

// 获取隐私协议
interface PoType {
  type: string;
}

// 获取协议
export const getPolicy = (data: PoType) =>
  request("/index/policy", "GET", data);

// 添加关注
export const addCare = (data: RequestAddCareType) =>
  request("/user/addCare", "POST", data);

// 取消关注
export const cancelCare = (data: RequestCencelCareType) =>
  request("/user/cancelCare", "POST", data);

// 获取关注列表
export const getCareList = (data: RequestCareListType) =>
  request("/user/getCare", "GET", data);

// 修改用户信息
export const updateInfo = (data: RequestUpadateUserInfo) =>
  request("/user/updateInfo", "POST", data);

// 获取我的评论
export const getMyComment = (data: RequestMyCommentType) =>
  request("/user/myComment", "GET", data);

// 获取收藏的职位
export const getCollectJob = (data: RequestMyCommentType) =>
  request("/user/myCollect", "GET", data);

// 收藏职位
export const collectJob = (data: RequestCollectJobType) =>
  request("/user/addCollect", "POST", data);

// 取消收藏职位
export const cencelCollectJob = (data: RequestCencelCollectJobType) =>
  request("/user/cancelCollect", "POST", data);

// 获取他人用户信息
interface GetUserInfoType {
  user_id: number;
}
export const getUserInfo = (data: GetUserInfoType) =>
  request("/user/userInfo", "GET", data);

// 获取我的信息
export const getMyInfo = (data: GetUserInfoType) =>
  request("/user/info", "GET", data);

// 获取我的足迹
export const getMyFoot = (data: RequestMyCommentType) =>
  request("/user/myFoot", "GET", data);

// 获取公告
export const getNotice = (data: RequestParmType) =>
  request("/index/getNotice", "GET", data);

// 获取职位信息列表
export const getDoubleList = (data: RequestJobParmType) =>
  request("/job_info/activityList", "GET", data);
